/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.mzk.oai.metadataRepository.cli;

import cz.mzk.oai.metadataRepository.cli.alephHarvest.ExportHarvester;
import cz.mzk.oai.metadataRepository.cli.alephHarvest.Harvester;
import cz.mzk.oai.metadataRepository.metadata.DateStamp;
import cz.mzk.oai.metadataRepository.repository.AlephBase;
import cz.mzk.oai.metadataRepository.repository.Repository;
import java.io.IOException;
import java.util.Properties;

/**
 *
 * @author Martin Řehánek (rehan at mzk.cz)
 */
public class HarvestMarcNewAction extends Action {

    private final Harvester harvester;
    private final DateStamp from;
    private final String alephBase;

    public HarvestMarcNewAction(Repository repository, Properties properties, String daysAgo, String alephBase) {
        super(repository);
        from = DateStamp.daysAgo(Integer.parseInt(daysAgo));
        harvester = new ExportHarvester(repository, properties);
        this.alephBase = alephBase;
    }

    public void run() throws IOException {
        harvester.harvestFrom(AlephBase.valueOf(alephBase), from);
    }
}
